<?php
/* include files needed to connect to database */
include 'system/libraries/database.php';
  session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>AllPrices-Categories-Stats</title> 
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <link rel="stylesheet" type="text/css" href="css/top-menu.css" /> 
           
    <link rel="stylesheet" type="text/css" href="css/styleMultiselect.css" />
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/jquery.multiselect.js"></script>

    <script type="text/javascript" src="js/registerUser.js"></script>
    <script type="text/javascript" src="js/stats/common.js"></script>
    <script type="text/javascript" src="js/stats/statsCategories.js"></script>
    <script type="text/javascript" src="js/flot/jquery.flot-with-plugins.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        InitFiltersForm();
      });
    </script>
  </head>

  <body>

    <div id="header" style="height: 75px;" class="block">
      <div id="logo" class="block">
        <a href="/"><img style="margin-bottom: 10px;" src="img/logo-beta.png" alt="AllPrices.md" /></a>
      </div>
    </div>  

    <div id="content">
      
      
    <div class="top_menu" id="menu">
      <ul class="blue">
        <li><a class="first" title="Overview" href="index.php"><span>Overview</span></a></li>
        <li><a class="current" title="Categories" href="categories.php"><span>Categories</span></a></li>
        <li><a title="Products" href="products.php"><span>Products</span></a></li>
      </ul>
      <div id="login">
        <?php 
          if(isset($_SESSION['name']))
            print '<span>Bun venit, <strong>' . $_SESSION['name'] . '</strong></span>';
          else
            print '<a id="sign-in-user" class="fancybox fancybox.ajax" href="iframe.php">Sign In</a>';
        ?>

        <?php
          if(isset($_SESSION['name']))
            print '<a id="sign-up-user" onclick="UserLogOut(); return false;" href="#"><strong>[Logout]</strong></a>';
          else
            print '<a id="sign-up-user" class="fancybox fancybox.ajax" href="iframe.php"> / Sign Up</a>';
        ?>
      </div>
    </div>
    <div class="clear"></div>
      
      <form id="main-form" action="#" method="GET" onsubmit="CheckResponseStatus(); return false;">
        
        <div class="inline-block dt-wrap">
          
          <span id="searchbar-input-container" class="inline-block">   
            <label for="datefrom">Date from:</label>
            <input id="datefrom" type="text" onblur="$(this).parent().removeClass('focus');" onfocus="$(this).parent().addClass('focus');" />
          </span>
        
          <span id="searchbar-input-container" class="inline-block">
            <label for="dateto">Date to:</label>
            <input id="dateto" type="text" onblur="$(this).parent().removeClass('focus');" onfocus="$(this).parent().addClass('focus');" />
          </span>
       
        
        <div id="options" >
          <select id="timeunit" onchange = "CheckResponseStatus(); return false;"> 
            <option value="day">day</option>
            <option value="week">week</option>
            <option value="month">month</option>
          </select>
                   
          <script type="text/javascript">
            $("select").multiselect(
            {
              multiple: false,
              header: "Select an option",
              noneSelectedText: "Select an Option",
              selectedList: 1
            });

          </script>
        </div>

        <div id="category_select_id"></div>
        
        <input class="button medium green" type="submit" value="Go" onclick="CheckResponseStatus(); return false;"/>
        
        </div>
        <div id="buttons">
          
          <input class="button medium green" type="submit" value ="<< week" onclick="DatePeriod('prevWeek'); return false;" />
          <input class="button medium green" type="submit" value ="week >>" onclick="DatePeriod('nextWeek'); return false;"/>
          <input class="button medium green" type="submit" value ="<< month" onclick="DatePeriod('prevMonth'); return false;"/>
          <input class="button medium green" type="submit" value ="month >>" onclick="DatePeriod('nextMonth'); return false;"/>
        </div>
        
    </form>
    <div style="padding: 0 auto">
      <h3> Top 4 categories by views</h3>
    <div id="product-price-history-flot"></div>
    </div>
    
    <table>
      <tr>
        <td style="vertical-align: top;" rowspan = "3">
          <h3>Top 10 Categories by views</h3>
          <div id="Data_table"></div>
        </td>
        
        <td style="vertical-align: top;">
          <h3> Top 10 Fastest growing Categories</h3>
          <div id="fastest-growing-catrgories"></div>
        </td>
      </tr>
    </table>

    </div>

  </body> 
  
</html>

